<?php

/**
 * This is the model class for table "owner".
 *
 * The followings are the available columns in table 'owner':
 * @property integer $owner_id
 * @property string $loginid
 * @property string $passwd
 * @property integer $inuse
 * @property string $firstname
 * @property string $lastname
 * @property string $username
 * @property string $company
 * @property string $email
 * @property string $paypal_email
 * @property string $telephone
 * @property string $fax
 * @property string $payableto
 * @property string $country
 * @property string $street
 * @property string $city
 * @property string $state
 * @property string $address
 * @property string $postcode
 * @property string $url
 * @property string $site
 * @property string $remark
 * @property integer $clicknum
 * @property integer $validclick
 * @property string $adddate
 * @property integer $usertype
 * @property string $startdate
 * @property integer $vaildclick
 * @property integer $totalclick
 * @property integer $loginnum
 * @property string $ip
 * @property string $paid_amount
 * @property string $balance
 * @property string $lastlogin
 * @property integer $joinmb
 * @property string $order_amount
 * @property double $payplan1
 * @property double $payplan2
 * @property double $payplan3
 * @property string $request_pay
 * @property string $request_pay_date
 * @property string $request_pay_detail
 * @property string $display
 * @property string $email_enabled
 */
class Owner extends CActiveRecord
{
	public $passwd2;
	/**
	 * Returns the static model of the specified AR class.
	 * @return Owner the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'owner';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('firstname, lastname, payableto, country, state, postcode, site, remark, usertype, ip, request_pay_date, request_pay_detail', 'required'),
			array('inuse, clicknum, validclick, usertype, vaildclick, totalclick, loginnum, joinmb, vjoinmb, ordernum', 'numerical', 'integerOnly'=>true),
			array('payplan1, payplan2, payplan3', 'numerical'),
			array('loginid', 'length', 'max'=>35),
			array('passwd, firstname, lastname, username, country', 'length', 'max'=>50),
			array('company', 'length', 'max'=>100),
			array('email, paypal_email, telephone, fax', 'length', 'max'=>60),
			array('payableto, state, url', 'length', 'max'=>200),
			array('street, city, address', 'length', 'max'=>250),
			array('postcode, ip', 'length', 'max'=>20),
			array('site', 'length', 'max'=>150),
			array('paid_amount, order_amount', 'length', 'max'=>12),
			array('balance', 'length', 'max'=>8),
			array('request_pay, display, email_enabled', 'length', 'max'=>1),
			array('adddate, startdate, lastlogin', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('owner_id, loginid, passwd, inuse, firstname, lastname, username, company, email, paypal_email, telephone, fax, payableto, country, street, city, state, address, postcode, url, site, remark, clicknum, validclick, adddate, usertype, startdate, vaildclick, totalclick, loginnum, ip, paid_amount, balance, lastlogin, joinmb, order_amount, payplan1, payplan2, payplan3, request_pay, request_pay_date, request_pay_detail, display, email_enabled', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'owner_id' => 'Owner',
			'loginid' => 'Account',
			'passwd' => 'Passwd',
			'passwd2' => 'Confirm Password',
			'inuse' => 'Inuse',
			'firstname' => 'Firstname',
			'lastname' => 'Lastname',
			'username' => 'Username',
			'company' => 'Company',
			'email' => 'Email',
			'paypal_email' => 'Paypal Email',
			'telephone' => 'Telephone',
			'fax' => 'Fax',
			'payableto' => 'Payableto',
			'country' => 'Country',
			'street' => 'Street',
			'city' => 'City',
			'state' => 'State',
			'address' => 'Address',
			'postcode' => 'Postcode',
			'url' => 'Url',
			'site' => 'Site',
			'remark' => 'Remark',
			'clicknum' => 'Clicknum',
			'validclick' => 'Validclick',
			'adddate' => 'Adddate',
			'usertype' => 'Usertype',
			'startdate' => 'Startdate',
			'vaildclick' => 'Vaildclick',
			'totalclick' => 'Totalclick',
			'loginnum' => 'Loginnum',
			'ip' => 'Ip',
			'paid_amount' => 'Paid Amount',
			'balance' => 'Balance',
			'lastlogin' => 'Lastlogin',
			'joinmb' => 'Members',
			'vjoinmb' => 'Valid Members',
			'order_amount' => 'Order Amount',
			'payplan1' => 'Payplan1',
			'payplan2' => 'Payplan2',
			'payplan3' => 'Payplan3',
			'request_pay' => 'Request Pay',
			'request_pay_date' => 'Request Pay Date',
			'request_pay_detail' => 'Request Pay Detail',
			'display' => 'Display',
			'email_enabled' => 'Email Enabled',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('owner_id',$this->owner_id);
		$criteria->compare('loginid',$this->loginid,true);
		$criteria->compare('passwd',$this->passwd,true);
		$criteria->compare('inuse',$this->inuse);
		$criteria->compare('firstname',$this->firstname,true);
		$criteria->compare('lastname',$this->lastname,true);
		$criteria->compare('username',$this->username,true);
		$criteria->compare('company',$this->company,true);
		$criteria->compare('email',$this->email,true);
		$criteria->compare('paypal_email',$this->paypal_email,true);
		$criteria->compare('telephone',$this->telephone,true);
		$criteria->compare('fax',$this->fax,true);
		$criteria->compare('payableto',$this->payableto,true);
		$criteria->compare('country',$this->country,true);
		$criteria->compare('street',$this->street,true);
		$criteria->compare('city',$this->city,true);
		$criteria->compare('state',$this->state,true);
		$criteria->compare('address',$this->address,true);
		$criteria->compare('postcode',$this->postcode,true);
		$criteria->compare('url',$this->url,true);
		$criteria->compare('site',$this->site,true);
		$criteria->compare('remark',$this->remark,true);
		$criteria->compare('clicknum',$this->clicknum);
		$criteria->compare('validclick',$this->validclick);
		$criteria->compare('adddate',$this->adddate,true);
		$criteria->compare('usertype',$this->usertype);
		$criteria->compare('startdate',$this->startdate,true);
		$criteria->compare('vaildclick',$this->vaildclick);
		$criteria->compare('totalclick',$this->totalclick);
		$criteria->compare('loginnum',$this->loginnum);
		$criteria->compare('ip',$this->ip,true);
		$criteria->compare('paid_amount',$this->paid_amount,true);
		$criteria->compare('balance',$this->balance,true);
		$criteria->compare('lastlogin',$this->lastlogin,true);
		$criteria->compare('joinmb',$this->joinmb);
		$criteria->compare('vjoinmb',$this->vjoinmb);
		$criteria->compare('order_amount',$this->order_amount,true);
		$criteria->compare('payplan1',$this->payplan1);
		$criteria->compare('payplan2',$this->payplan2);
		$criteria->compare('payplan3',$this->payplan3);
		$criteria->compare('request_pay',$this->request_pay,true);
		$criteria->compare('request_pay_date',$this->request_pay_date,true);
		$criteria->compare('request_pay_detail',$this->request_pay_detail,true);
		$criteria->compare('display',$this->display,true);
		$criteria->compare('email_enabled',$this->email_enabled,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}